package com.jeecms.wicool.manager.shops.impl;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeecms.cms.entity.main.CmsUser;
import com.jeecms.common.hibernate3.Updater;
import com.jeecms.common.page.Pagination;
import com.jeecms.wicool.dao.shops.WiShopInfoDao;
import com.jeecms.wicool.entity.shops.ShopInfo;
import com.jeecms.wicool.manager.shops.WiShopInfoMng;

@Service
@Transactional
public class WiShopInfoMngImpl implements WiShopInfoMng {
	HttpServletRequest request;
	private WiShopInfoDao dao;
	@Autowired
	public void setDao(WiShopInfoDao dao) {
		this.dao = dao;
	}
	
	@Transactional(readOnly = true)
	public Pagination getPage(int pageNo, int pageSize,CmsUser user) {
		Pagination page = dao.getPage(pageNo, pageSize,user);
		return page;
	}
	@Override
	public ShopInfo findById(Integer id) {
		ShopInfo entity = dao.findById(id);
		return entity;
	}

	@Override
	public ShopInfo update(ShopInfo bean) {
		Updater<ShopInfo> updater = new Updater<ShopInfo>(bean);
		bean = dao.updateByUpdater(updater);
		return bean;
	}

	@Override
	public List<ShopInfo> getAll(CmsUser user) {
		return dao.getAll(user);
	}
	@Override
	public ShopInfo deleteById(Integer id) {
		ShopInfo bean = dao.deleteById(id);
		return bean;
	}

	@Override
	public ShopInfo[] deleteByIds(Integer[] ids) {
		ShopInfo[] beans = new ShopInfo[ids.length];
		for (int i = 0,len = ids.length; i < len; i++) {
			beans[i] = deleteById(ids[i]);
		}
		return beans;
	}

}